home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / games / nhak_src.zip / RM.H < prev    next >
C/C++ Source or Header  |  1993-03-16  |  9KB  |  342 lines

  1. /*    SCCS Id: @(#)rm.h    3.0    88/10/25
  2. /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
  3. /* NetHack may be freely redistributed.  See license for details. */
  4.  
  5. #ifndef RM_H
  6. #define RM_H
  7.  
  8. /*
  9.  * The dungeon presentation graphics code and data structures were rewritten
  10.  * and generalized for NetHack's release 2 by Eric S. Raymond (eric@snark)
  11.  * building on Don G. Kneller's MS-DOS implementation. See options.c for
  12.  * the code that permits the user to set the contents of the symbol structure.
  13.  *
  14.  * The door representation was changed by Ari Huttunen(ahuttune@niksula.hut.fi)
  15.  */
  16.  
  17. /*
  18.  * TLCORNER    TDWALL        TRCORNER
  19.  * +-         -+-         -+
  20.  * |           |            |
  21.  *
  22.  * TRWALL    CROSSWALL    TLWALL        HWALL
  23.  * |           |           |
  24.  * +-         -+-         -+        ---
  25.  * |           |           |
  26.  *
  27.  * BLCORNER    TUWALL        BRCORNER    VWALL
  28.  * |           |           |        |
  29.  * +-         -+-         -+        |
  30.  */
  31.  
  32. /* Level location types */
  33. #define STONE        0
  34. #define HWALL        1
  35. #define VWALL        2
  36. #define TLCORNER    3
  37. #define TRCORNER    4
  38. #define BLCORNER    5
  39. #define BRCORNER    6
  40. #define CROSSWALL    7    /* For pretty mazes and special levels */
  41. #define TUWALL        8
  42. #define TDWALL        9
  43. #define TLWALL        10
  44. #define TRWALL        11
  45. #define SDOOR        12
  46. #define SCORR        13
  47. #define POOL        14
  48. #define MOAT        15    /* pool that doesn't boil, adjust messages */
  49. #define DRAWBRIDGE_UP    16
  50. #define DOOR        17
  51. #define CORR        18
  52. #define ROOM        19
  53. #define STAIRS        20
  54. #define LADDER        21
  55. #define FOUNTAIN    22
  56. #define THRONE        23
  57. #define SINK        24
  58. #define ALTAR        25
  59. #define DRAWBRIDGE_DOWN    26
  60.  
  61. /*
  62.  * Avoid using the level types in inequalities:
  63.  * these types are subject to change.
  64.  * Instead, use one of the macros below.
  65.  */
  66. #ifndef STUPID_CPP    /* otherwise these macros are functions in prisym.c */
  67. #define IS_WALL(typ)    ((typ) && (typ) <= TRWALL)
  68. #define IS_STWALL(typ)    ((typ) <= TRWALL)    /* STONE <= (typ) <= TRWALL */
  69. #define IS_ROCK(typ)    ((typ) < POOL)        /* absolutely nonaccessible */
  70. #define IS_DOOR(typ)    ((typ) == DOOR)
  71. #define ACCESSIBLE(typ)    ((typ) >= DOOR)        /* good position */
  72. #define IS_ROOM(typ)    ((typ) >= ROOM)        /* ROOM, STAIRS, furniture.. */
  73. #define ZAP_POS(typ)    ((typ) >= POOL)
  74. #define SPACE_POS(typ)    ((typ) > DOOR)
  75. #define IS_POOL(typ)    ((typ) >= POOL && (typ) <= DRAWBRIDGE_UP)
  76. #define IS_THRONE(typ)    ((typ) == THRONE)
  77. #define IS_FOUNTAIN(typ) ((typ) == FOUNTAIN)
  78. #define IS_SINK(typ)    ((typ) == SINK)
  79. #define IS_ALTAR(typ)    ((typ) == ALTAR)
  80. #define IS_DRAWBRIDGE(typ) ((typ) == DRAWBRIDGE_UP || (typ) == DRAWBRIDGE_DOWN)
  81. #define IS_FURNITURE(typ) ((typ) >= STAIRS && (typ) <= ALTAR)
  82. #endif
  83.  
  84. /*
  85.  * The level-map symbols may be compiled in or defined at initialization time
  86.  */
  87.  
  88. /* screen symbols for using character graphics. */
  89. #define S_stone        0
  90. #define S_vwall        1
  91. #define S_hwall        2
  92. #define S_tlcorn    3
  93. #define S_trcorn    4
  94. #define S_blcorn    5
  95. #define S_brcorn    6
  96. #define S_crwall    7
  97. #define S_tuwall    8
  98. #define S_tdwall    9
  99. #define S_tlwall    10
  100. #define S_trwall    11
  101. #define S_vbeam        12
  102. #define S_hbeam        13
  103. #define S_lslant    14
  104. #define S_rslant    15
  105. #define S_ndoor        16
  106. #define S_vodoor    17
  107. #define S_hodoor    18
  108. #define S_cdoor        19
  109. #define S_room        20
  110. #define S_corr        21
  111. #define S_upstair    22
  112. #define S_dnstair    23
  113. #define S_trap        24
  114. #define S_web        25
  115. #define S_pool        26
  116. #define S_fountain    27
  117. #define S_sink        28
  118. #define S_throne    29
  119. #define S_altar        30
  120. #define S_upladder    31
  121. #define S_dnladder    32
  122. #define S_dbvwall    33
  123. #define S_dbhwall    34
  124.  
  125. #define MAXPCHARS    35    /* maximum number of mapped characters */
  126.  
  127. typedef uchar symbol_array[MAXPCHARS];
  128.  
  129. extern symbol_array showsyms;
  130. extern const char *explainsyms[MAXPCHARS];  /* tells what the characters are */
  131. #ifdef REINCARNATION
  132. extern symbol_array savesyms;
  133. #endif
  134. extern symbol_array defsyms;
  135.  
  136. #define STONE_SYM    showsyms[S_stone]
  137. #define VWALL_SYM    showsyms[S_vwall]
  138. #define HWALL_SYM    showsyms[S_hwall]
  139. #define TLCORN_SYM    showsyms[S_tlcorn]
  140. #define TRCORN_SYM    showsyms[S_trcorn]
  141. #define BLCORN_SYM    showsyms[S_blcorn]
  142. #define BRCORN_SYM    showsyms[S_brcorn]
  143. #define CRWALL_SYM    showsyms[S_crwall]
  144. #define TUWALL_SYM    showsyms[S_tuwall]
  145. #define TDWALL_SYM    showsyms[S_tdwall]
  146. #define TLWALL_SYM    showsyms[S_tlwall]
  147. #define TRWALL_SYM    showsyms[S_trwall]
  148. #define VBEAM_SYM    showsyms[S_vbeam]
  149. #define HBEAM_SYM    showsyms[S_hbeam]
  150. #define LSLANT_SYM    showsyms[S_lslant]
  151. #define RSLANT_SYM    showsyms[S_rslant]
  152. #define NO_DOOR_SYM    showsyms[S_ndoor]
  153. #define H_OPEN_DOOR_SYM    showsyms[S_hodoor]
  154. #define V_OPEN_DOOR_SYM    showsyms[S_vodoor]
  155. #define CLOSED_DOOR_SYM    showsyms[S_cdoor]
  156. #define ROOM_SYM    showsyms[S_room]
  157. #define    CORR_SYM    showsyms[S_corr]
  158. #define UP_SYM        showsyms[S_upstair]
  159. #define DN_SYM        showsyms[S_dnstair]
  160. #define TRAP_SYM    showsyms[S_trap]
  161. #define WEB_SYM        showsyms[S_web]
  162. #define    POOL_SYM    showsyms[S_pool]
  163. #define FOUNTAIN_SYM    showsyms[S_fountain]
  164. #define SINK_SYM    showsyms[S_sink]
  165. #define THRONE_SYM    showsyms[S_throne]
  166. #define ALTAR_SYM    showsyms[S_altar]
  167. #define UPLADDER_SYM    showsyms[S_upladder]
  168. #define DNLADDER_SYM    showsyms[S_dnladder]
  169. #define DB_VWALL_SYM    showsyms[S_dbvwall]
  170. #define DB_HWALL_SYM    showsyms[S_dbhwall]
  171.  
  172. #define    ERRCHAR    ']'
  173.  
  174. /*
  175.  * The 5 possible states of doors
  176.  */
  177.  
  178. #define D_NODOOR    0
  179. #define D_BROKEN    1
  180. #define D_ISOPEN    2
  181. #define D_CLOSED    4
  182. #define D_LOCKED    8
  183. #define D_TRAPPED    16
  184.  
  185. /*
  186.  * The 3 possible alignments for altars
  187.  */
  188. #define A_CHAOS        0
  189. #define A_NEUTRAL    1
  190. #define A_LAW        2
  191.  
  192. /*
  193.  * Some altars are considered as shrines, so we need a flag.
  194.  */
  195. #define A_SHRINE    4
  196.  
  197. /*
  198.  * Thrones should only be looted once.
  199.  */
  200. #define T_LOOTED    1
  201.  
  202. /*
  203.  * The four directions for a DrawBridge.
  204.  */
  205. #define DB_NORTH    0
  206. #define DB_SOUTH    1
  207. #define DB_EAST     2
  208. #define DB_WEST     4
  209. #define DB_DIR        7    /* mask for direction */
  210.  
  211. /*
  212.  * What's under a drawbridge.
  213.  */
  214. #define DB_MOAT        0
  215. #define DB_FLOOR    8
  216. #define DB_ICE        16
  217. #define DB_UNDER    24    /* mask for underneath */
  218.  
  219. /* 
  220.  * Some walls may be non diggable.
  221.  */
  222. #define W_DIGGABLE    0
  223. #define W_NONDIGGABLE    1
  224. #define W_GATEWAY    16    /* is a drawbridge wall */
  225.  
  226. /*
  227.  * Ladders (in Vlad's tower) may be up or down.
  228.  */
  229. #define LA_UP        1
  230. #define LA_DOWN     2
  231.  
  232. /*
  233.  * Room areas may be iced pools,
  234.  */
  235. #define ICED_POOL    8
  236. #define ICED_MOAT    16
  237.  
  238.  
  239. /*
  240.  * at() display character types, in order of precedence.
  241.  */
  242. #ifndef MAXCOLORS
  243. #define MAXCOLORS    1
  244. #endif
  245.  
  246. #define AT_APP        (uchar)0
  247. /* 1-MAXCOLORS are specific overrides, see color.h */
  248. /* non-specific */
  249. #define AT_ZAP        (uchar)(MAXCOLORS+1)
  250. #define AT_MON        (uchar)(MAXCOLORS+2)
  251. #define AT_U        AT_MON
  252. #define AT_OBJ        (uchar)(MAXCOLORS+3)
  253. #define AT_GLD        AT_OBJ
  254. #define AT_MAP        (uchar)(MAXCOLORS+4)
  255.  
  256. /*
  257.  * The structure describing a coordinate position.
  258.  * Before adding fields, remember that this will significantly affect
  259.  * the size of temporary files and save files.
  260.  */
  261. struct rm {
  262.     uchar scrsym;
  263.     Bitfield(typ,5);
  264.     Bitfield(new,1);
  265.     Bitfield(seen,1);
  266.     Bitfield(lit,1);
  267.     Bitfield(doormask,5);
  268.     Bitfield(gmask,1);
  269. };
  270.  
  271. #define altarmask    doormask
  272. #define diggable    doormask
  273. #define ladder        doormask
  274. #define drawbridgemask    doormask
  275. #define looted        doormask
  276. #define icedpool    doormask
  277.  
  278. #ifdef MACOS
  279. typedef struct
  280. {
  281.     struct rm        **locations;
  282.     struct obj        ***objects;
  283.     struct monst    ***monsters;
  284.     struct obj        *objlist;
  285.     struct monst    *monlist;
  286. }
  287. dlevel_t;
  288. #else
  289. typedef struct
  290. {
  291.     struct rm        locations[COLNO][ROWNO];
  292. #ifndef MICROPORT_BUG
  293.     struct obj        *objects[COLNO][ROWNO];
  294.     struct monst    *monsters[COLNO][ROWNO];
  295. #else
  296.     struct obj        *objects[1][ROWNO];
  297.     char        *yuk1[COLNO-1][ROWNO];
  298.     struct monst    *monsters[1][ROWNO];
  299.     char        *yuk2[COLNO-1][ROWNO];
  300. #endif
  301.     struct obj        *objlist;
  302.     struct monst    *monlist;
  303. }
  304. dlevel_t;
  305. #endif
  306.  
  307. extern dlevel_t    level;    /* structure describing the current level */
  308.  
  309. /*
  310.  * Macros for compatibility with old code. Someday these will go away.
  311.  */
  312. #define levl        level.locations
  313. #define fobj        level.objlist
  314. #define fmon        level.monlist
  315.  
  316. #ifndef STUPID_CPP    /* otherwise these macros are functions */
  317. #define OBJ_AT(x, y)    (level.objects[x][y] != (struct obj *)0)
  318. /*
  319.  * Macros for encapsulation of level.monsters references.
  320.  */
  321. #define MON_AT(x, y)    (level.monsters[x][y] != (struct monst *)0)
  322. #define place_monster(m, x, y)    m->mx=x,m->my=y,level.monsters[m->mx][m->my]=m
  323. #define place_worm_seg(m, x, y) level.monsters[x][y] = m
  324. #define remove_monster(x, y)    level.monsters[x][y] = (struct monst *)0
  325. #define m_at(x, y)        level.monsters[x][y]
  326. #endif    /* STUPID_CPP */
  327.  
  328. #if defined(DGK) && !defined(OLD_TOS)
  329. #define ACTIVE    1
  330. #define SWAPPED    2
  331.  
  332. struct finfo {
  333.     int    where;
  334.     long    time;
  335.     long    size;
  336. };
  337. extern struct finfo fileinfo[];
  338. #define ZFINFO    { 0, 0L, 0L }
  339. #endif
  340.  
  341. #endif /* RM_H /**/
  342.